load required functions and packages:
source("sc_func.R")
suppressMessages(library(Rtsne))
suppressMessages(library(destiny))
suppressMessages(library(ggplot2))
suppressMessages(library(gplots))
suppressMessages(library(RColorBrewer))
load the data
load("sc_192.RData")
head(ph_data)
## CD16.32 CD11b CD135 CD127 CD150
## AGCGTCAT_AACAGCTC 982.3378 179.57397 245.2390 337.2304 156.07208
## AGCGTCAT_AACTCCAG 407.4659 190.37300 157.5722 727.4041 376.21133
## AGCGTCAT_AAGCCGTT 559.6830 50.00000 358.8045 274.8067 99.28712
## AGCGTCAT_AAGCTCTG 507.7003 99.29826 620.0193 224.3781 50.00000
## AGCGTCAT_ACACTGCA 674.4346 55.30264 843.7025 385.0173 55.13793
## AGCGTCAT_ACATGTCG 171.7648 50.00000 2537.2556 1241.0624 87.76251
## Sca.1 cKit
## AGCGTCAT_AACAGCTC 624.7090 10275.788
## AGCGTCAT_AACTCCAG 681.1675 9301.442
## AGCGTCAT_AAGCCGTT 3592.4006 6043.179
## AGCGTCAT_AAGCTCTG 2009.3131 10690.092
## AGCGTCAT_ACACTGCA 1903.8698 5888.153
## AGCGTCAT_ACATGTCG 996.0054 5305.947
expr_data[1:5,1:5]
## AGCGTCAT_AACAGCTC AGCGTCAT_AACTCCAG AGCGTCAT_AAGCCGTT
## Gnai3 19.298142 1.88219 4.365135
## Cdc45 3.216357 1.88219 0.000000
## Scml2 0.000000 0.00000 0.000000
## Narf 3.216357 0.00000 4.365135
## Cav2 0.000000 0.00000 0.000000
## AGCGTCAT_AAGCTCTG AGCGTCAT_ACACTGCA
## Gnai3 0.000000 5.627223
## Cdc45 4.061281 2.813611
## Scml2 0.000000 0.000000
## Narf 0.000000 0.000000
## Cav2 0.000000 0.000000
dim(expr_data)
## [1] 10017 187
plot(pca_out,n=20)
batch = rep(0,nrow(pca_out$x))
batch[grep("AGCGTCAT_",rownames(pca_out$x))] = 1
batch = as.factor(batch)
plot(pca_out$x[,1],pca_out$x[,2], col=batch)
plot(pca_out$x[,1],pca_out$x[,3], col=batch)
plot(pca_out$x[,1],pca_out$x[,4], col=batch)
plot(pca_out$x[,1],pca_out$x[,5], col=batch)
plot(pca_out$x[,3],pca_out$x[,4], col=batch)
for (i in 1:10)
{
print(paste("PCA@@@dimesion:",i))
print(head(pca_GO_list[[i]]))
}
## [1] "PCA@@@dimesion: 1"
## GO.ID Term Annotated
## 1 GO:0006259 DNA metabolic process 631
## 2 GO:0006260 DNA replication 231
## 3 GO:0006261 DNA-dependent DNA replication 90
## 4 GO:0006139 nucleobase-containing compound metabolic... 3201
## 5 GO:0006725 cellular aromatic compound metabolic pro... 3277
## 6 GO:0046483 heterocycle metabolic process 3278
## Significant Expected classic
## 1 27 3.20 7.7e-20
## 2 19 1.17 7.6e-19
## 3 13 0.46 3.3e-16
## 4 43 16.25 2.8e-15
## 5 43 16.64 7.2e-15
## 6 43 16.64 7.3e-15
## [1] "PCA@@@dimesion: 2"
## GO.ID Term Annotated
## 1 GO:0044707 single-multicellular organism process 2630
## 2 GO:0032501 multicellular organismal process 2790
## 3 GO:0006357 regulation of transcription from RNA pol... 1021
## 4 GO:0048518 positive regulation of biological proces... 2894
## 5 GO:0006366 transcription from RNA polymerase II pro... 1067
## 6 GO:0060348 bone development 82
## Significant Expected classic
## 1 29 13.63 4.5e-06
## 2 29 14.45 1.6e-05
## 3 16 5.29 3.3e-05
## 4 29 14.99 3.4e-05
## 5 16 5.53 5.7e-05
## 6 5 0.42 6.1e-05
## [1] "PCA@@@dimesion: 3"
## GO.ID Term Annotated
## 1 GO:0044707 single-multicellular organism process 2630
## 2 GO:0032501 multicellular organismal process 2790
## 3 GO:0001775 cell activation 486
## 4 GO:0007275 multicellular organism development 2208
## 5 GO:0030097 hemopoiesis 488
## 6 GO:0048534 hematopoietic or lymphoid organ developm... 513
## Significant Expected classic
## 1 34 13.35 9.0e-10
## 2 34 14.17 4.9e-09
## 3 15 2.47 8.8e-09
## 4 30 11.21 9.0e-09
## 5 15 2.48 9.4e-09
## 6 15 2.60 1.8e-08
## [1] "PCA@@@dimesion: 4"
## GO.ID Term Annotated
## 1 GO:0019886 antigen processing and presentation of e... 12
## 2 GO:0034341 response to interferon-gamma 38
## 3 GO:0021846 cell proliferation in forebrain 14
## 4 GO:0002495 antigen processing and presentation of p... 15
## 5 GO:0002504 antigen processing and presentation of p... 15
## 6 GO:0002478 antigen processing and presentation of e... 22
## Significant Expected classic
## 1 3 0.06 2.5e-05
## 2 4 0.19 3.5e-05
## 3 3 0.07 4.0e-05
## 4 3 0.07 5.0e-05
## 5 3 0.07 5.0e-05
## 6 3 0.11 1.7e-04
## [1] "PCA@@@dimesion: 5"
## GO.ID Term Annotated Significant Expected
## 1 GO:0002376 immune system process 1160 17 5.65
## 2 GO:0050832 defense response to fungus 12 3 0.06
## 3 GO:1903706 regulation of hemopoiesis 211 7 1.03
## 4 GO:0009620 response to fungus 20 3 0.10
## 5 GO:0072009 nephron epithelium development 25 3 0.12
## 6 GO:0009605 response to external stimulus 912 13 4.44
## classic
## 1 1.6e-05
## 2 2.3e-05
## 3 6.5e-05
## 4 1.2e-04
## 5 2.3e-04
## 6 2.9e-04
## [1] "PCA@@@dimesion: 6"
## GO.ID Term Annotated Significant Expected classic
## 1 GO:0000280 nuclear division 393 9 2.00 0.00014
## 2 GO:0007049 cell cycle 1080 15 5.48 0.00019
## 3 GO:0048285 organelle fission 422 9 2.14 0.00023
## 4 GO:0051301 cell division 448 9 2.27 0.00036
## 5 GO:0051321 meiotic cell cycle 124 5 0.63 0.00039
## 6 GO:0022402 cell cycle process 782 12 3.97 0.00041
## [1] "PCA@@@dimesion: 7"
## GO.ID Term Annotated
## 1 GO:0032606 type I interferon production 48
## 2 GO:0032481 positive regulation of type I interferon... 33
## 3 GO:0071621 granulocyte chemotaxis 39
## 4 GO:0060326 cell chemotaxis 93
## 5 GO:0032479 regulation of type I interferon producti... 45
## 6 GO:0097530 granulocyte migration 45
## Significant Expected classic
## 1 4 0.25 0.00010
## 2 3 0.17 0.00064
## 3 3 0.20 0.00105
## 4 4 0.48 0.00133
## 5 3 0.23 0.00159
## 6 3 0.23 0.00159
## [1] "PCA@@@dimesion: 8"
## GO.ID Term Annotated Significant
## 1 GO:0016569 covalent chromatin modification 337 10
## 2 GO:0016570 histone modification 331 9
## 3 GO:0016568 chromatin modification 458 10
## 4 GO:0006325 chromatin organization 494 10
## 5 GO:1903308 regulation of chromatin modification 114 5
## 6 GO:1902275 regulation of chromatin organization 121 5
## Expected classic
## 1 1.68 4.7e-06
## 2 1.65 3.0e-05
## 3 2.28 6.8e-05
## 4 2.46 1.3e-04
## 5 0.57 2.4e-04
## 6 0.60 3.2e-04
## [1] "PCA@@@dimesion: 9"
## GO.ID Term Annotated
## 1 GO:0051240 positive regulation of multicellular org... 707
## 2 GO:0044707 single-multicellular organism process 2630
## 3 GO:0001817 regulation of cytokine production 296
## 4 GO:0048731 system development 1925
## 5 GO:0032501 multicellular organismal process 2790
## 6 GO:0048513 animal organ development 1390
## Significant Expected classic
## 1 13 3.44 2.1e-05
## 2 26 12.81 4.4e-05
## 3 8 1.44 7.9e-05
## 4 21 9.37 1.0e-04
## 5 26 13.59 1.3e-04
## 6 17 6.77 1.7e-04
## [1] "PCA@@@dimesion: 10"
## GO.ID Term Annotated Significant
## 1 GO:0071496 cellular response to external stimulus 117 5
## 2 GO:0009267 cellular response to starvation 78 4
## 3 GO:0042594 response to starvation 87 4
## 4 GO:0032835 glomerulus development 11 2
## 5 GO:0035994 response to muscle stretch 11 2
## 6 GO:0031669 cellular response to nutrient levels 95 4
## Expected classic
## 1 0.61 0.00033
## 2 0.40 0.00069
## 3 0.45 0.00103
## 4 0.06 0.00140
## 5 0.06 0.00140
## 6 0.49 0.00144
dif <- DiffusionMap( pca_out$x[,c(2,3,5,7,8,9,10,11,12,13,14)],n.eigs = 10)
#plot(dif)
plot(dif@eigenvectors[,1],dif@eigenvectors[,2])
plot(dif@eigenvectors[,1],dif@eigenvectors[,3])
plot(dif@eigenvectors[,1],dif@eigenvectors[,4])
plot(dif@eigenvectors[,2],dif@eigenvectors[,3])
for (i in 1:10)
{
print(paste("diffusion map @@@dimension:",i))
print(dif_GO_list$GO_enrich[[i]])
}
## [1] "diffusion map @@@dimension: 1"
## GO.ID Term Annotated
## 1 GO:0048821 erythrocyte development 25
## 2 GO:0030218 erythrocyte differentiation 86
## 3 GO:0034101 erythrocyte homeostasis 93
## 4 GO:0061515 myeloid cell development 48
## 5 GO:0002262 myeloid cell homeostasis 111
## 6 GO:0048872 homeostasis of number of cells 199
## 7 GO:0001764 neuron migration 71
## 8 GO:0006929 substrate-dependent cell migration 12
## 9 GO:0019886 antigen processing and presentation of e... 12
## 10 GO:0002495 antigen processing and presentation of p... 15
## Significant Expected classic
## 1 6 0.22 5.2e-08
## 2 8 0.74 6.5e-07
## 3 8 0.80 1.2e-06
## 4 6 0.41 3.1e-06
## 5 8 0.95 4.6e-06
## 6 10 1.71 7.3e-06
## 7 6 0.61 3.1e-05
## 8 3 0.10 1.3e-04
## 9 3 0.10 1.3e-04
## 10 3 0.13 2.6e-04
## [1] "diffusion map @@@dimension: 2"
## GO.ID Term Annotated
## 1 GO:0048513 animal organ development 1390
## 2 GO:0044707 single-multicellular organism process 2630
## 3 GO:0048731 system development 1925
## 4 GO:0007275 multicellular organism development 2208
## 5 GO:0030097 hemopoiesis 488
## 6 GO:0032501 multicellular organismal process 2790
## 7 GO:0048534 hematopoietic or lymphoid organ developm... 513
## 8 GO:0030154 cell differentiation 1744
## 9 GO:0002520 immune system development 544
## 10 GO:0051240 positive regulation of multicellular org... 707
## Significant Expected classic
## 1 42 13.83 2.8e-12
## 2 57 26.16 3.3e-11
## 3 48 19.15 3.7e-11
## 4 51 21.96 1.0e-10
## 5 23 4.85 2.5e-10
## 6 57 27.75 4.2e-10
## 7 23 5.10 6.8e-10
## 8 43 17.35 1.2e-09
## 9 23 5.41 2.1e-09
## 10 26 7.03 2.9e-09
## [1] "diffusion map @@@dimension: 3"
## GO.ID Term Annotated
## 1 GO:0002376 immune system process 1160
## 2 GO:0044130 negative regulation of growth of symbion... 12
## 3 GO:0044146 negative regulation of growth of symbion... 12
## 4 GO:0044126 regulation of growth of symbiont in host 13
## 5 GO:0044144 modulation of growth of symbiont involve... 13
## 6 GO:0001909 leukocyte mediated cytotoxicity 50
## 7 GO:0006952 defense response 612
## 8 GO:0044110 growth involved in symbiotic interaction 15
## 9 GO:0044116 growth of symbiont involved in interacti... 15
## 10 GO:0044117 growth of symbiont in host 15
## Significant Expected classic
## 1 27 10.58 2.4e-06
## 2 4 0.11 3.0e-06
## 3 4 0.11 3.0e-06
## 4 4 0.12 4.3e-06
## 5 4 0.12 4.3e-06
## 6 6 0.46 5.6e-06
## 7 18 5.58 7.9e-06
## 8 4 0.14 8.2e-06
## 9 4 0.14 8.2e-06
## 10 4 0.14 8.2e-06
## [1] "diffusion map @@@dimension: 4"
## GO.ID Term Annotated
## 1 GO:0048821 erythrocyte development 25
## 2 GO:0030218 erythrocyte differentiation 86
## 3 GO:0034097 response to cytokine 294
## 4 GO:0034101 erythrocyte homeostasis 93
## 5 GO:0061515 myeloid cell development 48
## 6 GO:0002262 myeloid cell homeostasis 111
## 7 GO:0048568 embryonic organ development 211
## 8 GO:0002720 positive regulation of cytokine producti... 18
## 9 GO:0048513 animal organ development 1390
## 10 GO:0048534 hematopoietic or lymphoid organ developm... 513
## Significant Expected classic
## 1 6 0.21 4.9e-08
## 2 8 0.73 6.0e-07
## 3 13 2.50 1.0e-06
## 4 8 0.79 1.1e-06
## 5 6 0.41 2.9e-06
## 6 8 0.94 4.2e-06
## 7 10 1.79 1.1e-05
## 8 4 0.15 1.4e-05
## 9 27 11.81 1.7e-05
## 10 15 4.36 2.3e-05
## [1] "diffusion map @@@dimension: 5"
## GO.ID Term Annotated
## 1 GO:0044130 negative regulation of growth of symbion... 12
## 2 GO:0044146 negative regulation of growth of symbion... 12
## 3 GO:0044126 regulation of growth of symbiont in host 13
## 4 GO:0044144 modulation of growth of symbiont involve... 13
## 5 GO:0044110 growth involved in symbiotic interaction 15
## 6 GO:0044116 growth of symbiont involved in interacti... 15
## 7 GO:0044117 growth of symbiont in host 15
## 8 GO:0006935 chemotaxis 183
## 9 GO:0042330 taxis 185
## 10 GO:0050832 defense response to fungus 12
## Significant Expected classic
## 1 4 0.09 1.6e-06
## 2 4 0.09 1.6e-06
## 3 4 0.10 2.3e-06
## 4 4 0.10 2.3e-06
## 5 4 0.12 4.3e-06
## 6 4 0.12 4.3e-06
## 7 4 0.12 4.3e-06
## 8 8 1.42 8.2e-05
## 9 8 1.44 8.8e-05
## 10 3 0.09 9.4e-05
## [1] "diffusion map @@@dimension: 6"
## GO.ID Term Annotated
## 1 GO:0019886 antigen processing and presentation of e... 12
## 2 GO:0002495 antigen processing and presentation of p... 15
## 3 GO:0002504 antigen processing and presentation of p... 15
## 4 GO:0002478 antigen processing and presentation of e... 22
## 5 GO:0019884 antigen processing and presentation of e... 27
## 6 GO:0034341 response to interferon-gamma 38
## 7 GO:0048002 antigen processing and presentation of p... 39
## 8 GO:0034097 response to cytokine 294
## 9 GO:0019882 antigen processing and presentation 65
## 10 GO:0002694 regulation of leukocyte activation 246
## Significant Expected classic
## 1 4 0.03 2.8e-08
## 2 4 0.04 7.6e-08
## 3 4 0.04 7.6e-08
## 4 4 0.06 4.0e-07
## 5 4 0.08 9.5e-07
## 6 4 0.11 3.9e-06
## 7 4 0.11 4.3e-06
## 8 7 0.85 1.5e-05
## 9 4 0.19 3.4e-05
## 10 6 0.71 6.1e-05
## [1] "diffusion map @@@dimension: 7"
## GO.ID Term Annotated
## 1 GO:0002478 antigen processing and presentation of e... 22
## 2 GO:0019884 antigen processing and presentation of e... 27
## 3 GO:0019886 antigen processing and presentation of e... 12
## 4 GO:0002495 antigen processing and presentation of p... 15
## 5 GO:0002504 antigen processing and presentation of p... 15
## 6 GO:0048002 antigen processing and presentation of p... 39
## 7 GO:0006952 defense response 612
## 8 GO:0019882 antigen processing and presentation 65
## 9 GO:0034341 response to interferon-gamma 38
## 10 GO:0006955 immune response 585
## Significant Expected classic
## 1 5 0.07 6.2e-09
## 2 5 0.09 1.9e-08
## 3 4 0.04 4.2e-08
## 4 4 0.05 1.2e-07
## 5 4 0.05 1.2e-07
## 6 5 0.13 1.3e-07
## 7 11 1.97 1.6e-06
## 8 5 0.21 1.8e-06
## 9 4 0.12 6.0e-06
## 10 10 1.88 8.6e-06
## [1] "diffusion map @@@dimension: 8"
## GO.ID Term Annotated
## 1 GO:0019886 antigen processing and presentation of e... 12
## 2 GO:0002495 antigen processing and presentation of p... 15
## 3 GO:0002504 antigen processing and presentation of p... 15
## 4 GO:0002478 antigen processing and presentation of e... 22
## 5 GO:0019884 antigen processing and presentation of e... 27
## 6 GO:0048002 antigen processing and presentation of p... 39
## 7 GO:0019882 antigen processing and presentation 65
## 8 GO:0034341 response to interferon-gamma 38
## 9 GO:0050868 negative regulation of T cell activation 55
## 10 GO:0002579 positive regulation of antigen processin... 10
## Significant Expected classic
## 1 4 0.02 5.3e-09
## 2 4 0.03 1.4e-08
## 3 4 0.03 1.4e-08
## 4 4 0.04 7.7e-08
## 5 4 0.05 1.8e-07
## 6 4 0.08 8.4e-07
## 7 4 0.13 6.7e-06
## 8 3 0.07 5.2e-05
## 9 3 0.11 1.6e-04
## 10 2 0.02 1.6e-04
## [1] "diffusion map @@@dimension: 9"
## GO.ID Term Annotated
## 1 GO:0042108 positive regulation of cytokine biosynth... 35
## 2 GO:0001818 negative regulation of cytokine producti... 108
## 3 GO:0042035 regulation of cytokine biosynthetic proc... 51
## 4 GO:0042089 cytokine biosynthetic process 57
## 5 GO:0042107 cytokine metabolic process 57
## 6 GO:0044130 negative regulation of growth of symbion... 12
## 7 GO:0044146 negative regulation of growth of symbion... 12
## 8 GO:0042036 negative regulation of cytokine biosynth... 13
## 9 GO:0044126 regulation of growth of symbiont in host 13
## 10 GO:0044144 modulation of growth of symbiont involve... 13
## Significant Expected classic
## 1 3 0.08 6.4e-05
## 2 4 0.25 9.3e-05
## 3 3 0.12 2.0e-04
## 4 3 0.13 2.8e-04
## 5 3 0.13 2.8e-04
## 6 2 0.03 3.2e-04
## 7 2 0.03 3.2e-04
## 8 2 0.03 3.8e-04
## 9 2 0.03 3.8e-04
## 10 2 0.03 3.8e-04
## [1] "diffusion map @@@dimension: 10"
## GO.ID Term Annotated Significant Expected
## 1 GO:0048821 erythrocyte development 25 2 0.03
## classic
## 1 0.00049
tsne_diffmap = Rtsne(dif@eigenvectors[,])
tsne_diffmap1 = Rtsne(dif@eigenvectors[,],dim=1)
tsne_ph = Rtsne(log10(ph_data))
tsne_ph1 = Rtsne(log10(ph_data),dim=1)
plot(tsne_diffmap$Y[,1], tsne_diffmap$Y[,2])
plot(tsne_ph$Y[,1], tsne_ph$Y[,2])
plot(tsne_diffmap1$Y, tsne_ph1$Y)
tsne_df = data.frame(transcriptome_dim1 = tsne_diffmap$Y[,1],
transcriptome_dim2 = tsne_diffmap$Y[,2],
phenotype_dim1 = tsne_ph$Y[,1],
phenotype_dim2 = tsne_ph$Y[,2],
transcriptome_1d = tsne_diffmap1$Y[,1],
phenotype_1d = tsne_ph1$Y[,1])
combined_df = cbind(tsne_df,log10(ph_data),t(log2(expr_data+1)))
ggplot(combined_df,aes(x=transcriptome_1d,y=phenotype_1d,col=Rsad2))+geom_point()
write.csv(combined_df,file="shalin_192_pca_diff_new.csv", quote = FALSE)
diff_genes = c()
for(i in 1:10){diff_genes = c(diff_genes,rownames(dif_GO_list$DE_genes[[i]]))}
DE_expr = expr_data[rownames(expr_data) %in% diff_genes,]
dim(DE_expr)
## [1] 508 187
heatmap.2(log2(DE_expr+1),trace="none")
tsne_diffmap_DE = Rtsne(cor(log2(DE_expr+1)))
tsne_diffmap_DE1 = Rtsne(cor(log2(DE_expr+1)),dim=1)
plot(tsne_diffmap_DE$Y[,1], tsne_diffmap_DE$Y[,2])
plot(tsne_diffmap_DE1$Y, tsne_ph1$Y)
database = "haemopedia"
immgen_samples <- read.delim(paste0("~/Downloads/",database,"_samples.txt"), stringsAsFactors=FALSE)
immgen_probes <- read.delim(paste0("~/Downloads/",database,"_probes.txt"), header=FALSE, stringsAsFactors=FALSE)
immgen_expression <- read.delim(paste0("~/Downloads/",database,"_expression.txt"), stringsAsFactors=FALSE)
library('biomaRt')
mart <- useDataset("mmusculus_gene_ensembl", useMart("ensembl"))
G_list <- getBM(filters= "ensembl_gene_id", attributes= c("ensembl_gene_id", "external_gene_name", "description"),values=immgen_probes$V2 ,mart=mart)
immgen_probes = immgen_probes[immgen_probes$V2 %in% G_list$ensembl_gene_id,]
G_list = G_list[match(immgen_probes$V2, G_list$ensembl_gene_id),]
immgen_probes$external_gene_name = G_list$external_gene_name
immgen_expression = immgen_expression[immgen_expression$X %in% immgen_probes$V1,]
immgen_probes = immgen_probes[immgen_probes$V1 %in% immgen_expression$X,]
immgen_probes = immgen_probes[match(immgen_expression$X, immgen_probes$V1),]
immgen_expression$gene_id = immgen_probes$external_gene_name
immgen_expression = immgen_expression[!duplicated(immgen_expression$gene_id),]
rownames(immgen_expression) = immgen_expression$gene_id
immgen_expression = immgen_expression[,!(colnames(immgen_expression) %in% c("X","gene_id"))]
dim(immgen_expression)
## [1] 19180 169
table(immgen_samples$cell_lineage)
##
## B Cell Lineage Basophil Lineage
## 15 2
## Dendritic Cell Lineage Eosinophil Lineage
## 12 6
## Erythrocyte Lineage Macrophage Lineage
## 17 11
## Mast Cell Lineage Megakaryocyte Lineage
## 2 9
## Multi Potential Progenitor Neutrophil Lineage
## 17 5
## NK Cell Lineage Restricted Potential Progenitor
## 2 28
## T Cell Lineage
## 43
immgen_samples$sampleId = gsub("-",".",immgen_samples$sampleId)
#SC_list = immgen_samples[immgen_samples$cell_lineage == "Stem Cells", "sampleId"]
SC_list = immgen_samples$sampleId
sub_immgen_expression = immgen_expression[rownames(immgen_expression) %in% rownames(DE_expr), colnames(immgen_expression) %in% SC_list]
sub_DE_expr = DE_expr[rownames(DE_expr) %in% rownames(sub_immgen_expression),]
sub_DE_expr = sub_DE_expr[!duplicated(rownames(sub_DE_expr)),]
sub_DE_expr = sub_DE_expr[order(rownames(sub_DE_expr)),]
sub_immgen_expression = sub_immgen_expression[order(rownames(sub_immgen_expression)),]
p.val_mat = c()
for (i in 1:ncol(sub_immgen_expression))
{
p.val_vec = apply(sub_DE_expr, 2, function(x){
cor.test(x,sub_immgen_expression[,i],
method = "spearman",
alternative = "greater")$p.value})
p.val_mat = rbind(p.val_mat,-log10(p.val_vec))
}
rownames(p.val_mat) = colnames(sub_immgen_expression)
hmcol<-colorRampPalette(c("blue", "white","red"))(n = 299)
heatmap.2(p.val_mat,trace="none",
col=hmcol,
scale="column",
density.info="none",
key=FALSE)
tsne_immgen = Rtsne(cor(p.val_mat))
plot(tsne_immgen$Y[,1], tsne_immgen$Y[,2])